<!DOCTYPE html>
<html xmlns=http://www.w3.org/1999/xhtml xmlns:bd=http://www.baidu.com/2010/xbdml>
<head>
    <meta charset="utf-8">
    <title>维修服务</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/staff/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/staff/layout/css/font_eolqem241z66flxr.css" media="all" />
    <script type="text/javascript" src="/staff/layout/js/jquery.min.js"></script>
    <style type="text/css">
        th,td{
            text-align: center ! important;
        }
    </style>
</head>
<body class="childrenBody">
<blockquote class="layui-elem-quote news_search">
    <form class="layui-form" id="form" action="/admin/repair/index" method="get">
        <div class="layui-input-inline" style="margin-top: 5px; margin-right: 30px;">
            <label class="layui-form-label" style="padding: 0;width: 66px;height: 38px;background-color: #1aa094;text-align: center;line-height: 38px;border-radius: 2px;">维修单</label>
            <input type="text"  value="" placeholder="请输入维修单" class="layui-input search_input" style="width: 15em">
        </div>
        <div class="layui-input-inline" style="">
            <a class="layui-btn search_btn" style="margin-top: 5px;    background-color: #1e9c05;" id="repair">查询</a>
             <a class="layui-btn linksAdd_btn" style="background-color:#161917;margin-top: 5px;">添加</a>
        </div>
    </form>
</blockquote>

<div class="layui-form links_list">
    <table class="layui-table">
         {{ csrf_field() }}
        <thead>
        <tr>
            <th>维修单</th>
            <th>店铺区域</th>
            <th>店铺名称</th>
            <th>进度</th>
            <th>维修单状态</th>
            <th>受理人员</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody class="news_content">
        @if(!empty($data))
            @foreach($data as $v)
                <tr id="repair_{{$v['id']}}">
                    <td class="account" style="color: #33a41d">{{$v['id']}}</td>
                    <td>{{$v['shoparea']}}</td>
                    <td>{{$v['shopname']}}</td>
                    <td data-field="progress" align="center" data-content="75%">
                        <div class="layui-progress" lay-showPercent="yes">@if($v['status'] == 0) <div class="layui-progress-bar layui-bg-red" lay-percent="80%"></div> @else <div class="layui-progress-bar layui-bg-green" lay-percent="100%"></div> @endif</div>
                    </td>
                     <td style="text-align: center;">@if($v['status'] == 0) <span style="color: red">未完成 </span>@else <span style="color: green">已完成 </span> @endif</td>
                     <td >{{$v['people']}}</td>
                       <td><a class="layui-btn layui-btn-mini" onclick="editRepair({{$v['id']}})"><i class="iconfont icon-edit"></i> 编辑</a><a class="layui-btn layui-btn-danger layui-btn-mini" onclick="delRepair({{$v['id']}})" data-id="1"><i class="layui-icon"></i> 删除</a></td>
                     </tr>
            @endforeach
        @endif

</tbody>
</table>
</div>
</body>
<script type="text/javascript" src="/staff/layout/js/jquery.min.js"></script>
<script type="text/javascript" src="/staff/layui/layui.js"></script>

<script type="text/javascript">
    layui.config({
        base : "js/"
    }).use(['form','layer','jquery','laypage','element','laydate'],function(){
        var laydate = layui.laydate;
        var element = layui.element();
        var form = layui.form(),
            layer = parent.layer === undefined ? layui.layer : parent.layer,
            laypage = layui.laypage,
            $ = layui.jquery;

    })
    
      $('#repair').click(function () {
                $('#form').submit();
            })
          //操作
    $(".linksAdd_btn").click(function(){
        layui.layer.open({
            title : "添加维修单",
            type : 2,
            content : "/admin/repair/create",
             area: ['45em', '45em'],
             
            success : function(layero, index){
                layui.layer.tips('点击此处返回区域列表', '.layui-layer-setwin .layui-layer-close', {
                    tips: 3
                });
                } 
            })
    })

    function editRepair(id){  //编辑
        // layer.alert('您点击了友情链接编辑按钮，由于是纯静态页面，所以暂时不存在编辑内容，后期会添加，敬请谅解。。。',{icon:6, title:'友链编辑'});
        layui.layer.open({
            title : "编辑燃气",
            type: 2,
            content: '/admin/repair/edit?id='+id, //这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: ['http://sentsin.com', 'no']
            area: ['45em', '45em']
        });
    }

    function delRepair(id){  //删除
        layer.confirm('确定删除此信息？',{icon:3, title:'提示信息'},function(index){
            $.ajax({
                url:'/admin/repair/delete',
                type:'post',
                async:false,
                data:{
                    "_token": $("input[name=_token]").val(),
                    'id':id
                },
                dataType:'json',
                success:function (data) {
                    if(data.status == 1){
                        $('#repair_'+id).remove();
                    }
                }
            })
            layer.close(index);
        });
    }
</script>
</html>